package com.wlr.blog.article.controller;

import com.wlr.blog.article.service.JobService;
import com.wlr.blog.job.ScheduleUtils;
import com.wlr.blog.job.SysJob;
import com.wlr.blog.util.common.dto.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author lrwang
 * @version 1.0
 * @date 2022/11/22 13:42
 */
@RequestMapping("/job")
@RestController
public class JobController {
    @Autowired
    JobService jobService;

    @PostMapping("/start")
    public Result<?> startJob(@RequestBody SysJob job) {
        jobService.start(job);
        return Result.success();
    }
}
